//
// Created by LiuYou on 2021/5/6.
//

#include <fcntl.h>
#include "ClientData.hpp"

int setNonblocking(int fd) {
    int oldOption = fcntl(fd, F_GETFL);
    int newOption = oldOption | O_NONBLOCK;
    fcntl(fd, F_SETFL, newOption);
    return oldOption;
}

const sockaddr_in& ClientData::getAddress() const {
    return address;
}

void ClientData::setAddress(const sockaddr_in& address) {
    ClientData::address = address;
}

char* ClientData::getWriteBuf() const {
    return writeBuf;
}

void ClientData::setWriteBuf(char* writeBuf) {
    ClientData::writeBuf = writeBuf;
}

const char* ClientData::getBuf() const {
    return buf;
}
